<?php
namespace Home\Controller;
use \Think\Controller;

class MessageController extends HomeController {
		private $_model = null; //数据库操作类

		//初始化操作
		public function _initialize(){
			parent::_initialize();
			$this->_model = D('message');
		}
    
    public function index(){

       $this->display();
    }
    public function add(){
    	 
    		if(!$this->_model->create()){
				$this->error($this->_model->getError());
				exit;
			}

			if($this->_model->add() > 0){
				$this->success("添加成功！",U('Message/index'));
			}else{
				$this->error("添加失败！");
			}
    }
}